export default {
  inserted(el, binding, vnode, oldVnode) {
    let imgH = el.offsetHeight
    var mainH = document.querySelector('.main').offsetTop
    window.addEventListener('scroll', ()=>{
      let scrollTop = document.documentElement.scrollTop
      let nowH = imgH - scrollTop*(imgH-100)/(mainH - 100)
      // console.log(nowH)
      // el.style.top = `-${scrollTop*3}px`
      // let elH = el.style.height
      // console.log(parseInt(elH))

      if (nowH > 70){
        el.style.height = `${nowH}px`
      }else {
        el.style.height = `${70}px`
      }

    }, false)

  }
}
